<script setup lang="ts">
import { onMounted } from "vue";
import { useRouter } from "vue-router";

const router = useRouter();

// Listen for navigation events from the base app
onMounted(() => {
  if (window.$wujie && window.$wujie.bus) {
    window.$wujie.bus.$on("base-app:navigate", (_data: any) => {
      console.log("Received navigation event from base app:", _data);
      if (_data && _data.path) {
        router.push(  "/" + _data.path);
      }
    });
  }
});
</script>

<template>
  <div class="app-container">
    <router-view></router-view>
  </div>
</template>

<style scoped>
.app-container {
  padding: 20px;
}
</style>
